package com.dm.cloud.images.controller.defalut;

import com.dm.cloud.core.mode.ResultModel;
import com.dm.cloud.images.mode.NodeInfo;
import com.dm.cloud.oauthlib.service.anon.HasLogin;
import com.dm.cloud.tkmybatis.service.BaseEntityService;
import com.dm.cloud.tkmybatis.service.EntityBaseController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.dm.cloud.images.common.po.ImagesEndpoint;
import com.dm.cloud.images.common.dto.ImagesEndpointDTO;
import com.dm.cloud.images.common.request.ImagesEndpointSearchRequest;
import com.dm.cloud.images.service.ImagesEndpointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
   * @author hcx
   * @type ImagesEndpointController.java
   * @desc 服务节点表 ImagesEndpoint controller
   */
@RestController
@RequestMapping("/apis/v1/imagesEndpoint")
@Tag(name =  "服务节点表  ImagesEndpointcontroller")
@HasLogin
public class ImagesEndpointController extends EntityBaseController<ImagesEndpointSearchRequest, ImagesEndpoint, ImagesEndpointDTO> {
    @Autowired
    private ImagesEndpointService imagesEndpointService;
    @Override
    public ImagesEndpoint getEntity() {
        return new ImagesEndpoint();
    }

    @Override
    public ImagesEndpointDTO getDTO() {
        return new ImagesEndpointDTO();
    }

    @Override
    public BaseEntityService<ImagesEndpointSearchRequest, ImagesEndpoint> getService() {
        return imagesEndpointService;
    }

    @GetMapping("info")
    @Operation(summary = "节点详情")
    public ResultModel<NodeInfo> info(@Parameter(description = "节点ID",in = ParameterIn.QUERY) String nodeId){
        return ResultModel.success(imagesEndpointService.nodeInfo(nodeId));
    }

}
